﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThucThe;
using System.Data;
namespace KetNoi
{
    public class Tour_ketnoi
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable danhSachTour()
        {
            return kn.LayDuLieu("Tour_load");
        }
        public DataTable danhSachTourOnly()
        {
            return kn.LayDuLieu("Tour_load_only");
        }
        public DataTable timTour(Tour_thucthe tour)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenTour";
            value[0] = tour.TenTour;
            return kn.TimKiem("Tour_tim", name, value, Nparameter);
        }
        public int ThemTour(Tour_thucthe tour, ChiTiet_Tour_DiaDanh tour_dd, ChiTiet_Tour_KhachSan tour_ks, ChiTiet_Tour_NhaHang tour_nh, ChiTiet_Tour_VanTai tour_vt)
        {
            int Nparameter = 10;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "@maTour";            value[0] = tour.MaTour;
            name[1] = "@tenTour";           value[1] = tour.TenTour;
            name[2] = "@noiKhoiHanh";       value[2] = tour.NoiKhoiHanh;
            name[3] = "@giaCa";             value[3] = tour.GiaCa;
            name[4] = "@moTa";              value[4] = tour.MoTa;
            name[5] = "@maDiaDanh";          value[5] = tour_dd.MaDiaDanh;
            name[6] = "@maNhaHang";         value[6] = tour_nh.MaNhaHang;
            name[7] = "@maKhachSan";        value[7] = tour_ks.MaKhachSan;
            name[8] = "@maVanTai";          value[8] = tour_vt.MaVanTai;
            name[9] = "@loaiHinh";         value[9] = tour.LoaiHinh;
            return kn.CapNhat("Tour_them", name, value, Nparameter);
        }
        public int SuaTour(Tour_thucthe tour, ChiTiet_Tour_DiaDanh tour_dd, ChiTiet_Tour_KhachSan tour_ks, ChiTiet_Tour_NhaHang tour_nh, ChiTiet_Tour_VanTai tour_vt)
        {
            int Nparameter = 10;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "@maTour"; value[0] = tour.MaTour;
            name[1] = "@tenTour"; value[1] = tour.TenTour;
            name[2] = "@noiKhoiHanh"; value[2] = tour.NoiKhoiHanh;
            name[3] = "@giaCa"; value[3] = tour.GiaCa;
            name[4] = "@moTa"; value[4] = tour.MoTa;
            name[5] = "@maDiaDanh"; value[5] = tour_dd.MaDiaDanh;
            name[6] = "@maNhaHang"; value[6] = tour_nh.MaNhaHang;
            name[7] = "@maKhachSan"; value[7] = tour_ks.MaKhachSan;
            name[8] = "@maVanTai"; value[8] = tour_vt.MaVanTai;
            name[9] = "@loaiHinh"; value[9] = tour.LoaiHinh;
            return kn.CapNhat("Tour_sua", name, value, Nparameter);
        }
        public int XoaTour(Tour_thucthe tour)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maTour";
            value[0] = tour.MaTour;
            return kn.CapNhat("Tour_xoa", name, value, Nparameter);
        }
    }
}
